import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';
import postcss from 'postcss-pxtorem';
// https://vite.dev/config/
export default defineConfig({
  css:{
    postcss: {
      plugins: [
        postcss({
          rootValue({ file }) {
        return file.indexOf('vant') !== -1 ? 37.5 : 75;
      },
        propList: ['*'],
        selectorBlackList: [],
        })
      ]
    }
  },

  plugins: [
    vue(),
    AutoImport({
      resolvers: [VantResolver()],
    }),
    Components({
      resolvers: [VantResolver()],
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
    server: {
    proxy: {
      '/api': {
        target: 'http://192.168.8.5:8000',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
          '/v1':{
        target:'https://www.chunyuyisheng.com',
        changeOrigin:true,
        rewrite:path => path.replace(/^\/v1/,'')
      }
    }
    
  },
})
// const AlipaySdk = require('alipay-sdk').default;
// const alipaySdk = new AlipaySdk({
//   appId:'9021000139667178',
//   signType:'RSA2',
//   gateway: 'https://openapi.alipaydev.com/gateway.do', // 沙箱网关
//   privateKey:'MIIEowIBAAKCAQEAkLfBybUBUOdRFRp0iC60terzEM+7RtLt2TMwV1C1zWrtCZHWdejrK1tN+JlL731MZnQ83KYY6zhjh9pkL8pFaCvBHC9IUk0aQzYULgTrC+t3LImgA7voJsPJa3n/jRo782D6vPw8xe1lfmD+DvoenbEyhsCAY/nhnE3MfEKHocRgEFSKUxa3eS/sOwOlWvdoIiP+wcAuBKB5uiCh4wEYQPTx3IyeRK4nwIwacc8422vte+zfCBx5qxr0JH/X7z3KV0HSIb5gs3BrYpSMu2EYlDFAKGoYTre7rBRCdBYrncFDiF/puaSZpytpnweUBnbnashrBxpi5+Y02heLV6h2AQIDAQABAoIBACkFfZAAl+Pn/ereeePUYXMjq0y7pZlY1wT3Zp+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